<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="/sybida/common/js/locahostadress.js" charset="utf-8"></script>
    <link rel="stylesheet" href="/sybida/bs/bootstrap.min.css">
    <link rel="stylesheet" href="/sybida/layui/css/layui.css"  media="all">
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .body{
            width: 100%;
            /*border: blue solid 1px;*/
        }


        .body .header{
            width: 95%;
            /*border:black solid 1px;*/
            margin: 0 auto;
            margin-top: 5%;
        }

        .body .view{
            width: 95%;
            /*border: red solid 1px;*/
            margin: 0 auto;
        }

        .body .page{
            /*border: red solid 1px;*/
            margin: 0 auto;
            width: 95%;
        }
        body {
            margin: 10px;
        }

        .demo-carousel {
            height: 200px;
            line-height: 200px;
            text-align: center;
        }
    </style>

</head>
<body>
<br>
<span >

</span>
<div style="border-bottom: #0C0C0C 1px solid;">当前位置：<a href="/" class="nav_guide">所有班级信息</a>
</div>
<div class="container">
    <div class="header">
        <br>
        <div class="layui-form-item">
            <label class="bg-success" style="line-height: 35px; font-size: 16px;">每页大小:&nbsp;</label>
            <select class="form-control" id="pageSizeSel" style="width: 100px; display: inline-block" >
                <option name="pageSize" value="5">5条</option>
                <option name="pageSize" value="10">10条</option>
                <option name="pageSize" value="15">15条</option>
                <option name="pageSize" value="20">20条</option>
                <option name="pageSize" value="30">30条</option>
                <option name="pageSize" value="40">40条</option>
                <option name="pageSize" value="50">50条</option>
                <option name="pageSize" value="80">80条</option>
                <option name="pageSize" value="100">100条</option>
            </select>
            <label class="bg-success" style="line-height: 35px; font-size: 16px;">&nbsp;班&nbsp;&nbsp;级:&nbsp;</label>
            <select class="form-control" id="classNum" style="width: 200px; display: inline-block" >
            </select>
            <button type="button" id="selectButt" class="btn btn-success">&nbsp;查&nbsp;&nbsp;询&nbsp;</button>
    </div>
    </div>
    <div class="view">
        <table class="table table-striped table-hover table-bordered">
            <tr class="active">
                <th scope="col"><input type="checkbox" id="chk">&nbsp;&nbsp;全选</th>
                <th scope="col">班级名称</th>
                <th scope="col">任课教师</th>
                <th scope="col">班主任</th>
                <th scope="col">学习方向</th>
                <th scope="col">开课时间</th>
                <th scope="col">是否结业</th>
                <th scope="col">修改时间</th>
                <th scope="col">修改</th>
                <th scope="col">删除</th>
            </tr>
            <hr/>
        </table>
        <div id="nav">
        <nav style="text-align: center">
            <ul id="pagination" class="pagination" style="margin: 0 auto;">

            </ul>
        </nav>
        </div>
        <!--单个模态框-->
        <div class="modal fade" style="margin-top:100px;padding-top:100px;" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">

                    <div class="modal-body" style="margin-top: 20px;">
                        <form>
                            <div class="form-group" >
                                <label id="messagetext" class="control-label">Message:</label>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button"  class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" id="deleteOneSure" class="btn btn-primary">确定</button>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>
<!--<base href="/">-->
<!--多个删除模态框-->
<div class="modal fade" id="exampleModalAll" style="margin-top:100px;padding-top:100px;" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"></span></button>
                <h4 class="modal-title" id="exampleModalLabel">删除</h4>
            </div>
            <div class="modal-body" style="margin-top: 20px;">
                <form>
                    <div class="form-group">
                        <label id="mm" class="control-label">确认将所选的班级删除</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button"  id="canle" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="deleteAllSure" class="btn btn-primary">确认删除</button>
            </div>
        </div>
    </div>
</div>
<script src="/sybida/jquery/jquery-3.3.1.min.js"></script>
<script src="/sybida/layui/layui.js"></script>
<script src="/sybida/bs/bootstrap.min.js"></script>
<script src="/sybida/publicTool/js/classinfo.js"></script>
<script src="/sybida/publicTool/js/dateutil.js"></script>
<script>
    var layer
    layui.use('layer', function(){
        layer = layui.layer;
    });
    $("#canle").click(function (){
        $("#exampleModalAll").attr("class","modal fade")
        $("#exampleModalAll").css("display","none")
    })
    $("#deleteAllSure").click(function (){

        var checkbox = $("input[name='optionAll']");
        var s=new Array();
        var j=0
        for(var i = 0;i<checkbox.length;i++)
        {
            if(checkbox[i].checked==true)
            {
                s[j++]=(checkbox[i].value)
            }
        }
        if(s.length>0){
            var userid=getCookie("userid")
            $.post({
            url:url+"/classInfo/deleteAllClass",
            // 告知传递参数类型为json，不可缺少
            contentType:"application/json",
            data:JSON.stringify(s),
                beforeSend: function(request) {
                    request.setRequestHeader("token", userid);
                },
            success:function(data){
                if(data== -1000){
                    location.href=logindexurl
                }else {
                    if (data.code === 1) {
                        location.href = "/sybida/publicTool/classInfo.html?pageNum=1&pageSize=" + pageSize + "&selectClass=" + selectClass

                    } else {
                        layer.alert("删除失败请重试！");
                        $("#exampleModalAll").attr("class", "modal fade")
                        $("#exampleModalAll").css("display", "none")
                    }
                }
            }
        })}else{
            layer.alert("所选数据为空！");
            $("#exampleModalAll").attr("class","modal fade")
            $("#exampleModalAll").css("display","none")
        }
    })
</script>
</body>
</html>